import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:何人亮
 * Date:2024-05-07
 * 20:54
 */
public class Test {
    public static void main(String[] args) {
        int[] arr1={1,2,3,4,5,6};
        int[] arr2=fun(arr1);
        System.out.println(Arrays.toString(arr2));
    }

    public static int[] fun(int[] arr1){
        int j =0;
        int[] arr2=new int[arr1.length];
        for(int i=0;i< arr1.length;i++){
            if(arr1[i]%2!=0){
                arr2[j++]=arr1[i];
            }
        }
        for (int k = 0; k < arr1.length; k++) {
            if(arr1[k]%2==0){
                arr2[j++]=arr1[k];
            }
        }
        return arr2;
    }

}
